package com.zhuangyuan.cloud.data.model;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 10191042 on 2019-09-25.
 */
@Data
@Accessors(chain = true)
//@AllArgsConstructor
//@NoArgsConstructor
@XStreamAlias("menu-categories")
@Deprecated
public class MenuCategories{

    @XStreamImplicit(itemFieldName = "categories")
    private List<MenuCategory> categoryList;

    public MenuCategories(){
        this.categoryList = new ArrayList<>();
    }

    public void addCategory(MenuCategory category){
        this.categoryList.add(category);
    }


    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @XStreamAlias("category")
    public static class MenuCategory {

        @XStreamAlias("code")
        @XStreamAsAttribute
        private String categoryCode;
        @XStreamAlias("name")
        @XStreamAsAttribute
        private String categoryName;

        @XStreamAlias("level")
        @XStreamAsAttribute
        private int categoryLevel;

        public String getCategoryCode() {
            return categoryCode;
        }

        public void setCategoryCode(String categoryCode) {
            this.categoryCode = categoryCode;
        }

        public String getCategoryName() {
            return categoryName;
        }

        public void setCategoryName(String categoryName) {
            this.categoryName = categoryName;
        }

        public int getCategoryLevel() {
            return categoryLevel;
        }

        public void setCategoryLevel(int categoryLevel) {
            this.categoryLevel = categoryLevel;
        }
    }
}


